package com.example.paging3samples.database

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.example.paging3samples.database.model.RemoteKeys

/**
 * author: LiLiang
 * createTime: 2022/9/15-12:43
 * remark:
 **/
@Dao
interface RemoteKeysDao {

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insertAll(remoteKey: List<RemoteKeys>)

    @Query("SELECT * FROM RemoteKeys WHERE repoId = :id")
    suspend fun remoteKeysByRepoId(id: Int): RemoteKeys?

    @Query("DELETE FROM RemoteKeys")
    suspend fun clearRemoteKeys()
}